﻿//----------------------------------------------------------
// Description: create the session when user login
// Creater:     linjie 2008-10-25
//---------------------------------------------------------- 

using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Patent.LJ;


public partial class Web_GetTopic : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                
                string user = Session["userName"].ToString();
                string jsonString = getTopic(user);
                Response.ContentType = "text/plain";
                Response.Write(jsonString);
                Response.End();
            }
            catch (Exception)
            {

                throw;
            }
        }
        else
        {
            // do nothing.
        }
    }


    protected string getTopic(string user)
    {
        List<Topic> allTopics = PtCaseM.GetAll(user);
        if (allTopics == null)
        {
            return null;
        }

        string topicsJsonString = JavaScriptConvert.SerializeObject(allTopics);
        return topicsJsonString;
    }
}
